# $Id$
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Jameson Pugh <imntreal@gmail.com>
# Contributor: Tim Jester-Pfadt <t.jp<at>gmx.de>

pkgbase=appstream
pkgname=(appstream appstream-qt)
pkgver=0.11.6
pkgrel=1
pkgdesc="Provides a standard for creating app stores across distributions"
arch=(i686 x86_64)
url="http://distributions.freedesktop.org/wiki/AppStream"
license=(GPL)
depends=(libyaml libxml2 libstemmer glib2)
makedepends=(meson xmlto gobject-introspection python2 gtk-doc qt5-base itstool vala)
source=("https://www.freedesktop.org/software/appstream/releases/AppStream-$pkgver.tar.xz"{,.asc}
        update-appstream-cache.hook)
sha256sums=('0b1db9a3b2d754273677c7726557d90d462a933f52f29a2201f6fa8485877996'
            'SKIP'
            'a6c42e4607ffd7d7dc931d608f1856e2ba7689d4caac0783e7100d86de0f951b')
validpgpkeys=(D33A3F0CA16B0ACC51A60738494C8A5FBF4DECEB) # Matthias Klumpp <matthias@tenstral.net>

prepare() {
  mkdir -p build
}

build() {
  cd build

  meson ../AppStream-$pkgver \
    --prefix=/usr \
    -Dqt=true \
    -Dvapi=true
  ninja
}

package_appstream() {
  cd build

  DESTDIR="$pkgdir" ninja install

# provided by -qt subpackage
  rm -r "$pkgdir"/usr/{include/AppStreamQt,lib/cmake,lib/libAppStreamQt.*}

  install -Dm644 "$srcdir"/update-appstream-cache.hook "$pkgdir"/usr/share/libalpm/hooks/update-appstream-cache.hook
}

package_appstream-qt() {
  pkgdesc='Qt5 interface for AppStream'
  depends=(appstream qt5-base)

  cd build
  DESTDIR="$pkgdir" ninja install

# provided by appstream
  rm -r "$pkgdir"{/etc,/usr/{bin,include/appstream,lib/{girepository-1.0,libappstream*,pkgconfig},share}}
}
